   FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
   WORKDIR /app
   EXPOSE 5005

   # 此阶段用于生成服务项目
   FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
   ARG BUILD_CONFIGURATION=Release
   WORKDIR /src

   # 复制 NuGet.Config 文件
   COPY NuGet.Config ./

   COPY ["Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj", "Admin.NET.Web.Entry/"]
   COPY ["Admin.NET.Web.Core/Admin.NET.Web.Core.csproj", "Admin.NET.Web.Core/"]
   COPY ["Admin.NET.Core/Admin.NET.Core.csproj", "Admin.NET.Core/"]
   COPY ["Admin.NET.Application/Admin.NET.Application.csproj", "Admin.NET.Application/"]

   WORKDIR /src/Plugins
   COPY ["Plugins/Admin.NET.Plugin.ApprovalFlow/Admin.NET.Plugin.ApprovalFlow.csproj", "Admin.NET.Plugin.ApprovalFlow/"]
   COPY ["Plugins/Admin.NET.Plugin.DingTalk/Admin.NET.Plugin.DingTalk.csproj", "Admin.NET.Plugin.DingTalk/"]
   COPY ["Plugins/Admin.NET.Plugin.GoView/Admin.NET.Plugin.GoView.csproj", "Admin.NET.Plugin.GoView/"]
   COPY ["Plugins/Admin.NET.Plugin.K3Cloud/Admin.NET.Plugin.K3Cloud.csproj", "Admin.NET.Plugin.K3Cloud/"]
   COPY ["Plugins/Admin.NET.Plugin.WorkWeixin/Admin.NET.Plugin.WorkWeixin.csproj", "Admin.NET.Plugin.WorkWeixin/"]

   WORKDIR /src
   # 还原 NuGet 包，使用自定义的 NuGet.Config 文件
   RUN dotnet restore "./Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj" --configfile ./NuGet.Config

   # 复制所有项目文件
   COPY . .

   # 编译项目
   WORKDIR "/src/Admin.NET.Web.Entry"
   RUN dotnet build "./Admin.NET.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/build

   # 此阶段用于发布要复制到最终阶段的服务项目
   FROM build AS publish
   ARG BUILD_CONFIGURATION=Release
   RUN dotnet publish "./Admin.NET.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

   # 此阶段用于运行服务项目
   FROM base AS final
   WORKDIR /app
   COPY --from=publish /app/publish .

   # 设置语言/区域设置环境变量
   ENV LANG zh-Hans

   # 使用阿里云的镜像源进行更新
   # .NET6使用
   #RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/' /etc/apt/sources.list
   # .NET8使用
   RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/' /etc/apt/sources.list.d/debian.sources
   # 更新包管理器并安装free命令
   RUN apt-get update && apt-get install -y procps

   ENTRYPOINT ["dotnet", "Admin.NET.Web.Entry.dll"]
   